
library(testthat)
library(blma)
library(tictoc)
library(parallel)

cores <- detectCores()

test_that('comCrime produces correct results zellner_siow_gauss_laguerre', {
	set.seed(2019)
    comCrime <- get_comCrime()
    vy <- comCrime$vy
    mX <- comCrime$mX
    tic('comCrime produces correct results zellner_siow_gauss_laguerre')
    result <- sampler(100000, vy, mX, prior='zellner_siow_gauss_laguerre', modelprior='uniform', cores=cores)
    toc()
    expect_equal(result$vinclusion_prob, 
c(
0.9481000000000001,0.7679700000000000,0.2098300000000000,0.8056400000000000,
0.1881500000000000,0.6100900000000000,0.1574800000000000,0.3163600000000000,
0.1826100000000000,0.4641700000000000,0.2856300000000000,0.2411800000000000,
0.1680700000000000,0.2296200000000000,0.0928100000000000,0.1096300000000000,
0.1945200000000000,0.1645200000000000,0.2346800000000000,0.1307100000000000,
0.2140400000000000,0.1907300000000000,0.2358800000000000,0.1703700000000000,
0.1507400000000000,0.1191000000000000,0.1890200000000000,0.1330800000000000,
0.3101700000000000,0.1469800000000000,0.3874100000000000,0.1295700000000000,
0.1341700000000000,0.1388300000000000,0.2053900000000000,0.1308100000000000,
0.1396200000000000,0.1434500000000000,0.1339300000000000,0.7947400000000000,
0.2612800000000000,0.1715400000000000,0.3349800000000000,0.6340800000000000,
0.1889000000000000,0.3613300000000000,0.1111900000000000,0.1101900000000000,
0.8832000000000000,0.9655000000000000,0.9652300000000000,0.1153800000000000,
0.1618900000000000,0.2288500000000000,0.6148300000000000,0.1218700000000000,
0.1702600000000000,0.1428500000000000,0.1450600000000000,0.3202000000000000,
0.1330300000000000,0.3133700000000000,0.2295800000000000,0.2340500000000000,
0.2381500000000000,0.3239800000000000,0.2117200000000000,0.5454100000000000,
0.1486500000000000,0.0938500000000000,0.9327299999999999,0.2069100000000000,
0.1934400000000000,0.1034000000000000,0.1970700000000000,0.1114900000000000,
0.1440700000000000,0.2848100000000000,0.3390600000000000,0.2424000000000000,
0.2674700000000000,0.1134900000000000,0.1327000000000000,0.2865600000000000,
0.1802700000000000,0.1023900000000000,0.6498699999999999,0.1339500000000000,
0.3196600000000000,0.5682199999999999,0.1161100000000000,0.1274700000000000,
0.7790100000000000,0.1583900000000000,0.1447000000000000,0.1038900000000000,
0.0973700000000000,0.0960700000000000,0.9163800000000000
)
, tolerance = 1e-8)
})